# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-poetry-dynamic-versioning
pkgver=1.2.0
pkgrel=1
pkgdesc="Plugin for Poetry to enable dynamic versioning based on VCS tags"
url="https://github.com/mtkennerly/poetry-dynamic-versioning"
arch="noarch"
license="MIT"
depends="py3-dunamai py3-tomlkit py3-jinja2 py3-poetry-core"
makedepends="py3-gpep517 py3-poetry-core py3-wheel py3-installer"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://github.com/mtkennerly/poetry-dynamic-versioning/archive/v$pkgver/py3-poetry-dynamic-versioning-$pkgver.tar.gz"
builddir="$srcdir/poetry-dynamic-versioning-$pkgver"
options="!check" # tests require a git repo

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
7e12745045dfa8b8bc7c140165cb39eef0e0231e23903ed7f58761e109dc28254906bc9609fd4b830559a8c462bd3cf80ac7a0bb71f6ba91ae9ef3a2d70cd811  py3-poetry-dynamic-versioning-1.2.0.tar.gz
"
